package org.util;

import java.util.ArrayList;
import java.util.List;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class JQuery {
	
	private String dom;
	
	/**
	 * 获取本身对象
	 * @param dom
	 * @return
	 */
	public JQuery getInstall(String dom){
		
		this.dom = dom;
		
		return new JQuery();
	}

	/**
	 * 获取标签
	 * @param tag
	 * @return
	 */
	public List<String> get(String tag){
		
		List<String> list = new ArrayList<String>();
		
		Document doc = Jsoup.parse(this.dom);
		
		Elements as = doc.getElementsByTag(tag);
		
		for (Element a : as) {
			 list.add(a.toString());
		}
		
		return list;
		
	}
	
}
